package com.atguigu.order.feign;

import com.atguigu.order.feign.fallback.ProductFeignClientFallback;
import com.atguigu.product.bean.Product;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

//负载均衡 fallback兜底策略
@FeignClient(value = "service-product",fallback = ProductFeignClientFallback.class)
public interface OrderFeignClient {
    // @GetMapping用在controller里面，是接受请求的
    // @GetMapping用在feign里面，是发送请求的
    @GetMapping("/product/{id}")
    Product getProductById(@PathVariable("id") Long productId);
}
